passing custom parameters from jquery data table(fnServerData) to my custom web service

passing custom parameters from jquery data table(fnServerData) to my custom web service

geekinpurpleandpinkgeekinpurpleandpink Posts: 10Questions: 0Answers: 0
edited June 2012 in General
Hi,

I am trying to pass my custom parameters to my custom web service inside fnServerData, but I am getting 'undefined' row in the parameter headers
[code]
var oTable = $("#dataTableCustom").dataTable({
"iDisplayLength": 25,
"bDestroy": true,
"bProcessing": true,
"bJQueryUI": true,
"bAutoWidth": false,
"bServerSide": true,
"sAjaxSource": globalSource,
"sPaginationType": "full_numbers",
"fnServerData": function (sSource, aoData, fnCallback) {

aoData.push({ "listName": wcfListName, "columnNames": wcfColumnsToDisplay });
$.getJSON(sSource, aoData, function (json) {
var parsedJSON = $.parseJSON(json);
fnCallback(parsedJSON)
});
}
});
[/code]

thank you in advance for your help.

Replies

  • geekinpurpleandpinkgeekinpurpleandpink Posts: 10Questions: 0Answers: 0
    edited June 2012
    hi,

    solved it already.

    i just used fnServerParams instead :)

    here is the new initialization.

    [code]
    var oTable = $("#dataTableCustom").dataTable({
    "iDisplayLength": 25,
    "bDestroy": true,
    "bProcessing": true,
    "bJQueryUI": true,
    "bAutoWidth": false,
    "bServerSide": true,
    "sAjaxSource": globalSource,
    "sPaginationType": "full_numbers",
    "fnServerData": function (sSource, aoData, fnCallback) {
    $.getJSON(sSource, aoData, function (json) {
    var parsedJSON = $.parseJSON(json);
    fnCallback(parsedJSON)
    });
    },
    "fnServerParams": function (aoData) {
    aoData.push({
    "name": "listName",
    "value": wcfListName
    })
    aoData.push({
    "name": "columnNames",
    "value": wcfColumnsToDisplay
    })
    aoData.push({
    "name": "SortingDirection",
    "value": wcfSortDirection
    })
    aoData.push({
    "name": "sortingColumns",
    "value": wcfSortColumns
    })

    }
    });
    [/code]
This discussion has been closed.